<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">


    <link rel="stylesheet" href="jqueryweui/lib/weui.min.css">
    <link rel="stylesheet" href="jqueryweui/css/jquery-weui.css">
    <link rel="stylesheet" href="jqueryweui/demos/css/demos.css">
    <style type="text/css">

        .demos-content-padded {
            padding: 5px;
        }


    </style>
</head>
<body ontouchstart>
<div  class='demos-content-padded'>

    <div class="weui-cell" style="padding:0px 0px 0px 0px;">
        <div class="weui-cell__bd" style="color:#c69952;font-size: 16px;margin-top:5px;margin-left:5px;">
            <div style="color:#c69952;font-size: 16px;margin-top:1px;margin-right:1px;">历史留言</div>
        </div>
        <div class="weui-cell__ft" onclick="pcolse();" style="color:#c69952;font-size: 16px;margin-top:1px;margin-right:10px;">关闭</div>
    </div>
    <div class="weui-panel">
        <div class="weui-panel__bd" id="list">
            <div style="display: none;" class="weui-media-box weui-media-box_text">
                <p class="weui-media-box__desc" style="color: #0d0d0d;font-size: 14px;">祝网站开业大吉！</p>
                <ul class="weui-media-box__info">
                    <li class="weui-media-box__info__meta">许诺</li>
                    <li class="weui-media-box__info__meta"></li>
                    <li class="weui-media-box__info__meta weui-media-box__info__meta_extra">2019-05-11 17:00:43</li>
                </ul>
            </div>
        </div>
    </div>

</div>
<div class="weui-loadmore">
    <span id="msgtext" class="weui-loadmore__tips" onclick="loadData()">点击加载更多</span>
</div>
<script src="jqueryweui/lib/jquery-2.1.4.js"></script>
<script src="jqueryweui/lib/fastclick.js"></script>
<script>
    $(function () {
        FastClick.attach(document.body);
    });
</script>
<script src="jqueryweui/js/jquery-weui.js"></script>

<script>
    var state=true;
    var wpage = 1;
    clickMore(wpage);
    function loadData(){
        clickMore(wpage);
    }

    function clickMore(page){
        if(state){
            state = false;
            $.ajax({
                type: "get",
                url: "/mobile/loadctdata?limit=10&offset="+page,
                data: {},
                dataType: "json",
                success: function (ret) {
                    var countPage = ret.data.pages;
                    countPage = Number(countPage);
                    if(page >= countPage){
                        state = false;
                        $("#msgtext").text("没有更多数据了");
                        return;
                    }
                    wpage=page+1;
                    var listdata = ret.data.list;
                    if(listdata){
                        for(var i=0;i<listdata.length;i++){
                            var thtml = '<div class="weui-media-box weui-media-box_text">';
                            thtml += '<p class="weui-media-box__desc" style="color: #0d0d0d;font-size: 14px;">'+listdata[i].content+'</p>';
                            thtml += '<ul class="weui-media-box__info">';
                            thtml += '<li class="weui-media-box__info__meta">'+listdata[i].name+'</li>';
                            thtml += '<li class="weui-media-box__info__meta"></li>';
                            thtml += '<li class="weui-media-box__info__meta weui-media-box__info__meta_extra">'+listdata[i].createAt+'</li>';
                            thtml += '</ul>';
                            thtml += '</div>';
                            $("#list").append(thtml);
                        }
                        state = true;
                    }else{
                        state = false;
                    }
                }
            });
        }else{
            console.info("page:"+page);
            console.info("没有更多数据 了");
        }


    }


    function pcolse() {
        parent.fff();
    }

</script>
</body>

</html>
